const { Schema, SchemaTypes } = require('../schema');
const ChargeRecordStatus = require('../../module/const/ChargeRecordStatus');
// 充值记录（充值订单）
class ChargeRecord extends Schema {
    PropertyModelDataTemplate () {
        return {
            areaId: {
                type: SchemaTypes.ObjectId,
                required: true
            },
            userId: {
                type: SchemaTypes.ObjectId,
                required: true
            },
            createTime: {
                type: SchemaTypes.Number,
                required: true,
                default: require('../../module/tool/time').getCurrentTimestamp()
            },

            packageId: {
                type: SchemaTypes.ObjectId,
                required: false,
                comment: '套餐id'
            },
            fee: {
                type: SchemaTypes.Number,
                required: false,
                comment: '充值金额'
            },
            giftFee: {
                type: SchemaTypes.Number,
                required: false,
                comment: '赠送金额'
            },
            orderNo: {
                type: SchemaTypes.String,
                required: true,
                comment: '订单号'
            },
            accountId: {
                type: SchemaTypes.ObjectId,
                required: true,
                comment: '充值账户Id'
            },

            prepayId: {
                type: SchemaTypes.String,
                required: false,
                comment: '微信支付预支付id'
            },
            paymentOrderId: {
                type: SchemaTypes.String,
                required: false,
                comment: '支付id'
            },
            status: {
                type: SchemaTypes.Number,
                required: true,
                default: ChargeRecordStatus.enumValue.WaitingPay
            },
            payTime: {
                type: SchemaTypes.Number,
                required: false,
                comment: '支付时间'
            }
        };
    }
}

module.exports = ChargeRecord;
